<template>
  <div class="h-search-top">
    <div class="search-wrap" v-show="isShow">
      <div class="cell">
        <input type="text" placeholder="请输入关键字搜索">
      </div>
      <div class="cance">武汉</div>
    </div>
    <div class="c-title" v-show="!isShow">
      <div class="back" @click="goBack">返回</div>
      <div class="txt">{{title}}</div>
      <div class="right">搜索</div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["isShow", "title"],
  methods: {
    goBack() {
      this.$router.go(-1);
    }
  }
};
</script>

<style lang="scss">
.h-search-top {
  box-sizing: border-box;
  padding: 0 12px;
  height: 44px;
  line-height: 44px;
  background: #ee4433;
  color: #fff;
  text-align: center;
  .search-wrap {
    display: flex;
    .cell {
      flex: 1;
      border-radius: 4px;
      background: #fff;
      line-height: 32px;
      height: 32px;
      margin-top: 6px;
      > input {
        width: 100%;
        height: 100%;
        border: 0;
        outline: 0;
        border-radius: 4px;
        background: transparent;
        padding-left: 30px;
      }
    }
    .cance {
      width: 60px;
      text-align: center;
      font-size: 16px;
      color: #fff;
    }
  }
  .c-title {
    font-size: 18px;
    .back {
      position: absolute;
      top: 0;
      left: 0;
      margin-left: 12px;
    }
    .txt {
      width: 180px;
      font-size: 18px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin: 0 auto;
    }
    .right {
      position: absolute;
      top: 0;
      left: auto;
      right: 0;
      margin-right: 12px;
      text-align: right;
    }
  }
}
</style>

